package trading_strategy.events;

/**
 * Created by IntelliJ IDEA.
 * User: gderoujoux
 * Date: 6 mai 2010
 * Time: 16:47:36
 * To change this template use File | Settings | File Templates.
 */
public class ScheduledEvent extends AbstractMarketEvent implements Comparable {
    public static enum EventType {
        START, STOP, EMERGENCY_LIQUIDATION
    }

    EventType type;

    public ScheduledEvent(EventType type, long startTs, int delayIsMs) {
        super(startTs + delayIsMs * 1000l);
        this.type = type;
    }

    @Override
    public int compareTo(Object o) {
        if (!(o instanceof AbstractMarketEvent)) {
            return 1;
        }
        AbstractMarketEvent e = (AbstractMarketEvent) o;
        long diff = getTs() - e.getTs();
        if (diff > 0) {
            return 1;
        } else if (diff == 0) {
            return 0;
        } else {
            return 0;
        }
    }

    public EventType getType() {
        return type;
    }
}
